go to previous page   go to home page   hear noise   go to next page

Answer:

No. The compiler completely ignores them. Comments are just for human readers of the source program.


Many Comments

class Haiku
{
  public static void main ( String[] args )
  {
    System.out.println("On a withered branch" );      // Write first line of the poem
    System.out.println("A crow has just alighted:");  // Write 2nd line of the poem
    System.out.println("Nightfall in autumn.");       // Write 3rd line of the poem
  }
}

Comments can be placed after a program statement to explain what it does, as here.

The // and everything after on that line are ignored by the compiler. The program statement in the start of the line is not affected by the comment.


QUESTION 16:

Would you ever want to write an entire paragraph of comments?